package com.sskj.functions.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.MD5Util;
import com.sskj.functions.activity.InvestActivity;
import com.sskj.functions.presenter.BasePresenter;
import com.sskj.lib.bean.HeaderBean;
import com.sskj.lib.bean.StrategyBean;
import com.sskj.lib.bean.UsableBean;
import com.sskj.lib.http.JsonCallBack;


/**
 * @author Hey
 * Create at  2019/07/05
 */
public class InvestPresenter extends BasePresenter<InvestActivity> {

    public void startInvest(String toString, String id, String tv) {
        httpService.startInvest(toString, id, MD5Util.getFiveMd5Value(tv))
                .tag(this)
                .execute(new JsonCallBack<HttpData>() {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        mView.InvestSuccess();
                    }
                });
    }

    public void getUsable(String id) {
        httpService.getUsable(id)
                .tag(this)
                .execute(new JsonCallBack<HttpData<UsableBean>>() {
                    @Override
                    public void onSuccess(Response<HttpData<UsableBean>> response) {
                        mView.getUsableOK(response.body().getData());
                    }
                });
    }
}
